package com.example.cms;

import javax.servlet.MultipartConfigElement;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.MultipartConfigFactory;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@SpringBootApplication
@MapperScan("com.example.cms.dao")
@Configuration
public class CmsApplication// extends SpringBootServletInitializer
{
//
//	@Override
//	protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
//		return builder.sources(CmsApplication.class);
//	}

	public static void main(String[] args) {
		SpringApplication.run(CmsApplication.class, args);
	}

	@Bean
	public MultipartConfigElement multipartConfigElement() {  
	    MultipartConfigFactory factory = new MultipartConfigFactory();  
	    //单个文件最大  
	    factory.setMaxFileSize("2048MB"); //KB,MB  
	    /// 设置总上传数据总大小  
	    factory.setMaxRequestSize("2048MB");  
	   
	     return factory.createMultipartConfig();  
	}

}
